init python:
    class ParallaxTransform:
        def __init__(self, depth, base_xpos=0.5, intensity=0.1):
            self.depth = depth
            self.base_xpos = base_xpos
            self.intensity = intensity
            
        def __call__(self, trans, st, at):
            # 获取鼠标位置
            mouse_pos = renpy.get_mouse_pos()
            if mouse_pos:
                mouse_x = mouse_pos[0]
            else:
                mouse_x = config.screen_width / 2
                
            screen_width = config.screen_width
            center_x = screen_width / 2
            
            # 计算偏移
            offset = (mouse_x - center_x) / center_x
            final_offset = offset * (1.0 / self.depth) * self.intensity
            
            # 更新位置
            trans.xpos = self.base_xpos - final_offset
            
            return 0.016

# 创建transform实例
default parallax_bg = ParallaxTransform(3.0, 0.5, 0.1)
default parallax_mid = ParallaxTransform(2.0, 0.5, 0.1)
default parallax_fg = ParallaxTransform(1.0, 0 , 0.1)


screen working_parallax_demo():
    zorder -100
    
    # 背景层 - 移动最慢
    add "images/bg_1.jpg":
        zoom 1.8
        xalign 0.5
        yalign 0.5
        
        at transform:
            function parallax_bg
        
    
    # 中景层 - 移动中等
    frame:
        #background Solid("#0000001c", xsize=500, ysize=200)
        background None
        xalign 0.25
        yalign 0.3
        at transform:
            function parallax_mid
        vbox:
        # 设置文本颜色、大小、位置
            
            text "SEIREN  PROJECT":
                color "#89c7fe"  # 
                size 140
                xalign 0.0  # 左对齐
                #outlines [ (1, "#000000", 0, 0) ] 
                bold True
            
                
            # text "年龄：未知":
            
        
    
    # 前景层 - 移动最快 - 这里放置character_show的内容
    frame:
        background None
        
        xpos 0.5
        ypos 0.15
        at transform:
            zoom 1
            function parallax_fg
        
        use character_screen


label start:
    show screen working_parallax_demo
    "蓝" "天气真好呢！"
    "左右移动鼠标，观察不同图层的移动速度..."
    "背景层移动最慢，前景层移动最快！"
    return